Subscribe Us

Responsive Advertisement

Advertisement

514A Chewbaсca and Number codeforces solution in cpp

 

514A Chewbaсca and Number codeforces solution in cpp

by ujjal roy




#include<bits/stdc++.h>

using namespace std;

main()

{

    int i;

    string x,s;

    cin>>s;

    for(i=0;i<s.size();i++)

    {

        if(i==0&&s[i]=='9')

        {

            x+=s[i];

        }

        else

        {

            if(s[i]>='5')

            {

               int r=s[i]-'0',a;

               a=9-r;

               char c=a+48;

               x+=c;

            }

            else x+=s[i];

        }


    }


    cout<<x<<endl;



    return 0;

}


Post a Comment

0 Comments